#ifndef __LDX_CRENDERSTATECONSOLE_H_INCLUDE__
#define __LDX_CRENDERSTATECONSOLE_H_INCLUDE__
#include "LDXConfig.h"
#include "IReferenceCounted.h"
#include "SDeviceMap.h"

namespace ldx
{
	namespace render
	{
		enum E_RASTER_STATE_TYPES
		{
			ERST_DEFAULT,
			ERST_WIREFILE,
			ERST_DEPTHDISABLE,
			ERST_NOTCULL,
			ERST_CULLFRONT,
			ERST_COUNT//count of raster states.
		};
		//! Depth state types.
		enum E_DEPTH_STATE_TYPES
		{
			//! Defualt,enable depth and disable stencil.
			EDST_DEFAULT,
			//! Depth disable,stencil disable.
			EDST_DEPTHDIS_STENCILDIS,
			//! Depth enable,stencil enable.
			//EDST_DETPHEN_STENCILEN,			
			// count of this enum,not use.
			EDST_COUNT,
		};
		//! Console for raster state,blend state,depth stencil state.
		/**
		* This class will hold the states created ,and provide functions
		* to set states.
		* If want to extend types of raster or depth or blend,
		* should change enum,setFunction,initFunction and delete function.
		*/
		class CRenderStateConsole :public IReferenceCounted
		{
		public:
			CRenderStateConsole(SDeviceMap dm);
			~CRenderStateConsole();

			//! Set raster state.Don't input param with value:ERST_COUNT
			int setRasterState(E_RASTER_STATE_TYPES rasterstate);

			//! Set depth state.Don't input param with value:EDST_COUNT.
			int setDepthState(E_DEPTH_STATE_TYPES depthstate);

			//! ori: top-left
			int serRasterViewPort(float width, float height, float topleftX = 0.f, float topleftY = 0.f, float depthmin = 0.f, float depthmax = 1.0f);

			D3D11_VIEWPORT getRasterViewPort();

		private:
			SDeviceMap DM;

			//! Create all raster states first,and set default.
			bool initRasterStates();
			void deleteRasterStates();

			//! For depth state.
			bool initDepthStates();
			void deleteDepthStates();

			ID3D11RasterizerState* RasterizerStates[ERST_COUNT];
			D3D11_VIEWPORT VP;

			ID3D11DepthStencilState* DepthStencilState[EDST_COUNT];
		};
	}
}
#endif // !__LDX_CRENDERSTATECONSOLE_H_INCLUDE__
